import React, { useEffect } from 'react';
import { Button, DatePicker } from 'antd';
import Clock, { Toggle } from '@/Clock';

// 2021-04-05
import RState from '@/component/20210405/RState';
import RToggle from '@/component/20210405/RToggle';
// 2021-04-06
import Numlist from '@/component/20210406/RListKey';
import RForm from '@/component/20210406/RForm';
// 2021-04-07
import Calculator from '@/component/20210407/stateUp';
import WelcomeDialog from '@/component/20210407/comInherit';
import DemoColumn from '@/component/chart';

// 2023-09-25
import { RSA, testKey } from '../utils/encryption_decryption';
import { AESEncrypt, AESDecrypt, AES } from '../utils/encryption_decryption';

export default function Home() {
  useEffect(() => {
    // !AES 对称加密
    const secret = AESEncrypt('我是一个来传递明文加密的：?type=tlx').toString();
    console.log('AES 对称加密 ---===---', secret);
    console.log('AES 对称 解密 ===---===', AESDecrypt(secret).toString());
    const aesA = AES.encrypt('123456 对错✅');
    console.log('aesA encrypt', aesA, AES.decrypt(aesA));

    // !RSA 非对称加密
    const new_rsa = new RSA();
    new_rsa.encryption('6yuiop');
    testKey('hfjkad789');
  }, []);

  return (
    <div className='my__component__wrapper'>
      Home page
      <Clock />
      <Toggle />
      <DatePicker />
      <Button type='primary' style={{ marginLeft: 8 }}>
        Primary Button
      </Button>
      {/* 20210405测试学习 */}
      <RState />
      <RToggle />
      {/* 2021 04 06 学习 */}
      <Numlist />
      <RForm />
      {/* 2021 04 05 状态提升 */}
      <Calculator />
      <WelcomeDialog />
      {/* 2021 04 12 回到顶部 */}
      {/* <ScrollToTop /> */}
      <DemoColumn />
      {/* 加密 解密 */}
    </div>
  );
}
